<template>
  <div>
    <el-button @click="add" type="primary">新增</el-button>
    <FormItem v-for="(item,index) in formDataList" :formDataList="formDataList" :index="index" :key="'DynamicForm'+index"></FormItem>
  </div>
</template>

<script>
import FormItem from './FormItem';
export default {
  name: 'ForForm',
  props: {
    formValue: {
      type: [],
      default: () => {
        return []
      }
    },
  },
  components: { FormItem },
  data() {
    return {
      formDataList: [{}],
    };
  },
  watch: {
    formDataList: {
       handler(val, oldV) {
         this.$emit('update:formValue', val)
      },
      deep: true,
    }
  },
  methods: {
    add() {
      this.formDataList.push({});
    },
  },
};
</script>

<style scoped lang="scss">
</style>
